package com.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONArray;
import com.pojo.vo.vo_ResponseBody;
import com.service.ManagerService;

@RequestMapping("managerController")
@Controller
public class managerController {

	@Autowired
	private ManagerService managerService;
	
	public managerController(){
		System.out.println("managerController 实例化");
	}
	
	@RequestMapping(value="getAllUser",produces="application/json;charset=UTF-8",method={RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public String getAllUser(){
		String data="";
		try{
			data=managerService.getAllUser();
		}catch (Exception e) {
			e.printStackTrace();
			data=JSONArray.toJSONString(new vo_ResponseBody(-1,0,"服务器异常"));
		}
		return data;
	}
	
	@RequestMapping(value="changeStateByUsers_id",produces="application/json;charset=UTF-8",method={RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public String changeStateByUsers_id(Integer users_id,Boolean enable){
		String data="";
		try{
			data=managerService.changeStateByUsers_id(users_id,enable);
		}catch (Exception e) {
			e.printStackTrace();
			data=JSONArray.toJSONString(new vo_ResponseBody(-1,0,"服务器异常"));
		}
		return data;
	}
	
}
